set nocompatible
"配置插件管理
filetype off

let s:bundle_home = g:spx_home.'/.vim/bundle/'
let s:bundle_plug = s:bundle_home.'vim-plug/plug.vim'

"load plug.vim bundle
" source g:spx_home.'/.vim/bundle/vim-plug/plug.vim'
exec ":source ".s:bundle_plug
call plug#begin(s:bundle_home)

"--------------------
" for common
"--------------------

Plug 'xvhfeng/vim-plug'

Plug 'vim-scripts/genutils'

"Plug 'vim-scripts/ZoomWin'

"move bunch
Plug 'easymotion/vim-easymotion'
" <Leader>f{char} to move to {char}
map  gc <Plug>(easymotion-bd-f)
nmap gc <Plug>(easymotion-overwin-f)

" s{char}{char} to move to {char}{char}
nmap gb <Plug>(easymotion-overwin-f2)

" Move to line
map gl <Plug>(easymotion-bd-jk)
nmap gl <Plug>(easymotion-overwin-line)

" Move to word
map  gw <Plug>(easymotion-bd-w)
nmap gw <Plug>(easymotion-overwin-w)

" These `n` & `N` mappings are options. You do not have to map `n` & `N` to
" EasyMotion.
" Without these mappings, `n` & `N` works fine. (These mappings just provide
" different highlight method and have some other features )
map  n <Plug>(easymotion-next)
map  N <Plug>(easymotion-prev)

Plug 'vim-scripts/ZoomWin'

Plug 'trotter/autojump.vim'


Plug 'terryma/vim-expand-region'
map + <Plug>(expand_region_expand)
map _ <Plug>(expand_region_shrink)

" 快速加入修改环绕字符
" put ds' delete '
" put cs' ( change ' to ()
" ysiw' insert ' round word with space
" ysiwb insert () round word without space
" yss' insert ' round line
Plug 'tpope/vim-surround'
nmap yw ysiwb
nmap  yl yssb

" for repeat -> enhance surround.vim, . to repeat command
Plug 'tpope/vim-repeat'

" 快速去行尾空格 [, + <Space>]
Plug 'bronson/vim-trailing-whitespace'
map <leader>es :FixWhitespace<cr>

map  / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)

"多字节支持
Plug 'vim-scripts/FencView.vim'

Plug 'vim-scripts/auto_mkdir'

Plug 'bling/vim-airline'
let g:airline#extensions#tabline#enabled = 0
let g:airline_section_b = '%{strftime("%Y-%m-%d %T")}'

Plug 'Yggdroot/indentLine'
"config for indentLine
let g:indentLine_indentLevel = 15
let g:indentLine_enabled = 1
"hi Conceal ctermfg=red ctermbg=red
"let g:indentLine_char = '|'

"--------------------
" for c
"--------------------

Plug 'vim-scripts/a.vim'
if (!exists('g:alternateSearchPath'))
    let g:alternateSearchPath = 'sfr:./,sfr:include/,sfr:../,sfr:header/,sfr:../src,sfr:../include,sfr:../header,sfr:../../include,sfr:../../src'
endif

"设置c语言的header和c文件转换
nnoremap he <ESC>:w!<ESC>:A!<CR>
nnoremap <c-x>h <ESC>:w!<ESC>:A!<cr>

Plug 'preservim/nerdcommenter'
" Create default mappings
let g:NERDCreateDefaultMappings = 1
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Enable NERDCommenterToggle to check all selected lines is commented or not
let g:NERDToggleCheckAllLines = 1

" [count]<leader>cc |NERDCommenterComment|
" Comment out the current line or text selected in visual mode.
"
" [count]<leader>cn |NERDCommenterNested|
" Same as cc but forces nesting.
"
" [count]<leader>c<space> |NERDCommenterToggle|
" Toggles the comment state of the selected line(s). If the topmost selected line is commented, all selected lines are uncommented and vice versa.
"
" [count]<leader>cm |NERDCommenterMinimal|
" Comments the given lines using only one set of multipart delimiters.
"
" [count]<leader>ci |NERDCommenterInvert|
" Toggles the comment state of the selected line(s) individually.
"
" [count]<leader>cs |NERDCommenterSexy|
" Comments out the selected lines with a pretty block formatted layout.
"
" [count]<leader>cy |NERDCommenterYank|
" Same as cc except that the commented line(s) are yanked first.
"
" <leader>c$ |NERDCommenterToEOL|
" Comments the current line from the cursor to the end of line.
"
" <leader>cA |NERDCommenterAppend|
" Adds comment delimiters to the end of line and goes into insert mode between them.
"
" |NERDCommenterInsert|
" Adds comment delimiters at the current cursor position and inserts between. Disabled by default.
"
" <leader>ca |NERDCommenterAltDelims|
" Switches to the alternative set of delimiters.
"
" [count]<leader>cl |NERDCommenterAlignLeft [count]<leader>cb |NERDCommenterAlignBoth
" Same as |NERDCommenterComment| except that the delimiters are aligned down the left side (<leader>cl) or both sides (<leader>cb).
"
" [count]<leader>cu |NERDCommenterUncomment|
" Uncomments the selected line(s).



" 多语言语法检查
Plug 'scrooloose/syntastic'
let g:syntastic_error_symbol='>>'
let g:syntastic_warning_symbol='>'
let g:syntastic_check_on_open=1
let g:syntastic_enable_highlighting = 0
let g:syntastic_python_checkers=['pyflakes'] " 使用pyflakes,速度比pylint快
highlight SyntasticErrorSign guifg=white guibg=black

Plug 'tpope/vim-commentary'

Plug 'vim-scripts/DoxygenToolkit.vim'
let g:DoxygenToolkit_returnTag="@Returns:"
let g:DoxygenToolkit_paramTag_pre="@"
let g:DoxygenToolkit_briefTag_pre="@Remark:"
map <c-x><c-f> <ESC>:Dox<cr>

"--------------------
" for subject
"--------------------
"主题 solarized
Plug 'altercation/vim-colors-solarized'
"let g:solarized_termcolors=256
let g:solarized_termtrans=1
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"

"主题 molokai
Plug 'tomasr/molokai'
"let g:molokai_original = 1

"Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'kamichidu/vim-edit-properties'

"--------------------
" for html, haml, sass
"--------------------
Plug 'vim-scripts/JSON.vim'

"--------------------
" for database
"--------------------
Plug 'vim-scripts/SQLComplete.vim'
let g:sql_type_default = 'mysql'

Plug 'Shougo/vimproc'
Plug 'Shougo/unite.vim'
let g:unite_enable_split_vertically = 1
let g:unite_source_file_async_command = "ls -las"
let g:unite_ignore_source_files = ['*.o']
let g:unite_source_history_yank_enable = 1
let g:unite_enable_start_insert = 1
let g:unite_source_line_enable_highlight = 1


"内置exploer
nnoremap <c-g> :Explore <CR>
nnoremap <silent> <leader>gg :Explore <CR>
let g:netrw_hide = 1 "设置默认隐藏
let g:netrw_liststyle = 3 " tree 模式显示风格
let g:netrw_banner = 0 " 显示帮助信息
let g:netrw_browse_split = 0 "控制 <CR> 直接在当前窗口打开光标下文件
let g:netrw_winsize = 30 " 占用宽度
let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+' " 需要隐藏的文件
let g:netrw_localrmdir = 'trash' "默认的删除工具使用 trash
let g:netrw_altv = 1 " 控制 v 分裂的窗口位于右边
let g:netrw_preview = 1 " 默认是水平分割, 此项设置使之垂直分割
let g:netrw_alto = 0 " 控制预览窗口位于左侧或右侧, 与 netrw_preview 共同作用
" let g:netrw_chgwin = 2 " 控制按下 <CR> 的新文件在位于屏幕右侧的 2 号窗口打开, Lex 默认会设为 2


Plug 'Shougo/unite-outline'
nnoremap <c-x>o :Unite  -start-insert -no-split outline<CR>

Plug 'majutsushi/tagbar'
nnoremap <c-c>o :TagbarToggle<CR>

let g:tagbar_width=60
let g:tagbar_right=1
" 启动时自动focus
let g:tagbar_autofocus = 1
map + :tagbar_map_openfold
map - :tagbar_map_closefold

Plug 'ervandew/supertab'

Plug 'Yggdroot/LeaderF'
let g:Lf_WorkingDirectoryMode = 'F'
let g:Lf_WindowPosition = 'fullScreen'
let g:Lf_PreviewInPopup = 1
let g:Lf_StlSeparator = { 'left': "\ue0b0", 'right': "\ue0b2", 'font': "DejaVu Sans Mono for Powerline" }
"let g:Lf_PreviewResult = {'Function': 0, 'BufTag': 0 }

nnoremap <c-c><c-f> :Leaderf rg <SPACE>
noremap <c-x><c-f> :<C-U><C-R>=printf("Leaderf! rg -e %s ", expand("<cword>"))<CR>
"select file from current floder
let g:Lf_ShortcutF = "<leader>ff"
" select from opened buffer
noremap fb :<C-U><C-R>=printf("Leaderf buffer %s", "")<CR><CR>
" select from history
noremap fm :<C-U><C-R>=printf("Leaderf mru %s", "")<CR><CR>
"select from current buffer
noremap fl :<C-U><C-R>=printf("Leaderf line %s", "")<CR><CR>
xnoremap fg :<C-U><C-R>=printf("Leaderf! rg -F -e %s ", leaderf#Rg#visual())<CR>
noremap fh :<C-U>Leaderf! rg --recall<CR>
"自动生成tags
let g:Lf_GtagsAutoGenerate = 1
noremap fr :<C-U><C-R>=printf("Leaderf! gtags -r %s --auto-jump", expand("<cword>"))<CR><CR>
noremap fd :<C-U><C-R>=printf("Leaderf! gtags -d %s --auto-jump", expand("<cword>"))<CR><CR>
noremap fo :<C-U><C-R>=printf("Leaderf! gtags --recall %s", "")<CR><CR>
noremap fn :<C-U><C-R>=printf("Leaderf gtags --next %s", "")<CR><CR>
noremap fp :<C-U><C-R>=printf("Leaderf gtags --previous %s", "")<CR><CR>


noremap <m-m> :Leaderf! mru<cr>
noremap <m-f> :LeaderfFunction!<cr>
noremap <m-b> :Leaderf! buffer<cr>
noremap <m-t> :LeaderfTag<cr>
let g:Lf_CommandMap = {'<C-K>': ['<c-p>'], '<C-J>': ['<c-n>']}
let g:Lf_StlSeparator = { 'left': '', 'right': '', 'font': '' }
let g:Lf_RootMarkers = ['.project', '.root', '.svn', '.git']
let g:Lf_WorkingDirectoryMode = 'Ac'
let g:Lf_WindowHeight = 0.30
let g:Lf_CacheDirectory = expand('~/.cache/')
let g:Lf_ShowRelativePath = 0
let g:Lf_HideHelp = 1
let g:Lf_StlColorscheme = 'powerline'
let g:Lf_PreviewResult = {'Function':0, 'BufTag':0}

"中文排版"
Plug 'hotoo/pangu.vim'

Plug 'will133/vim-dirdiff'

"cmake的提示
Plug 'pboettch/vim-cmake-syntax'

"光标下的单词高亮"
Plug 'pboettch/vim-highlight-cursor-words'
let g:HiCursorWords_linkStyle='VisualNOS'

Plug 'xvhfeng/vim-clang-format'
let g:clang_format#auto_format = 1
" map to <Leader>cf in C++ code
autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR>
autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR>
" " if you install vim-operator-user
"autocmd FileType c,cpp,objc map <buffer><Leader>x <Plug>(operator-clang-format)
" " Toggle auto formatting:
nmap <Leader>C :ClangFormatAutoToggle<CR>
let g:clang_format#style_options = {
            \ "AllowShortFunctionsOnASingleLine" : "None",
            \"AllowShortIfStatementsOnASingleLine" : "false",
            \"AllowShortLoopsOnASingleLine" : "false",
            \"AllowAllParametersOfDeclarationOnNextLine" : "false",
            \"BinPackArguments" :   "true",
            \"BinPackParameters" :  "false",
            \"BreakBeforeBinaryOperators" : "All",
            \"BreakBeforeTernaryOperators" : "true",
            \"ConstructorInitializerAllOnOneLineOrOnePerLine" : "true",
            \"ColumnLimit" : "0",
            \"Cpp11BracedListStyle" : "false",
            \"ExperimentalAutoDetectBinPacking" : "true",
            \"ReflowComments" : "true",
            \"SortIncludes" :   "true",
            \"SpaceAfterCStyleCast" : "true",
            \"SpaceInEmptyParentheses" : "true",
            \"SpacesInParentheses" :    "false",
            \"SpacesInSquareBrackets" : "true",
            \"SpaceBeforeAssignmentOperators" : "true",
            \"UseTab" : "Never",
            \"AlignTrailingComments" : "true",
            \"CommentPragmas" :  "'^ IWYU pragma:'"
            \}

Plug 'xvhfeng/gft4c'

"括号对齐颜色
Plug 'luochen1990/rainbow'
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle

Plug 'xvhfeng/google.vim'

Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }

Plug 'rust-lang/rust.vim'

Plug 'wellle/context.vim'
let g:context_enabled = 1
autocmd VimEnter     * ContextActivate
autocmd BufAdd       * call context#update('BufAdd')
autocmd BufEnter     * call context#update('BufEnter')
autocmd CursorMoved  * call context#update('CursorMoved')
autocmd VimResized   * call context#update('VimResized')
autocmd CursorHold   * call context#update('CursorHold')
autocmd User GitGutter call context#update('GitGutter')
nnoremap <silent> <C-Y> <C-Y>:call context#update('C-Y')<CR>
nnoremap <silent> <C-E> <C-E>:call context#update('C-E')<CR>
nnoremap <silent> zz       zz:call context#update('zz')<CR>
nnoremap <silent> zb       zb:call context#update('zb')<CR>
nnoremap <silent> <expr> zt context#util#map_zt()
nnoremap <silent> <expr> H  context#util#map_H()

"Plug 'vifm/vifm.vim'
"nnoremap <silent> <leader>mm :Vifm<CR>

"need install ranger
"replace vifm
Plug 'rbgrouleff/bclose.vim'
Plug 'francoiscabrol/ranger.vim'
"open ranger when vim open a directory
let g:ranger_replace_netrw = 1
nnoremap <silent> <leader>mm :Ranger<CR>

Plug 'jlanzarotta/bufexplorer'
nnoremap <silent> <c-x>b :ToggleBufExplorer<CR>
nnoremap <silent> <leader>bb :ToggleBufExplorer<CR>
nnoremap <silent> <c-x><c-b> :BufExplorerVerticalSplit<CR>
nnoremap <silent> <leader>bb :ToggleBufExplorer<CR>

Plug 'vim-scripts/lemon.vim'

"----------------------------------------------------------------------
" unimpaired
" [ ] 开头的快捷键,vim缺失的快捷键
"----------------------------------------------------------------------
Plug 'tpope/vim-unimpaired'


"----------------------------------------------------------------------
" tags
" 自动生成代码的tags
"----------------------------------------------------------------------
Plug 'ludovicchabant/vim-gutentags'
" gutentags 搜索工程目录的标志，当前文件路径向上递归直到碰到这些文件/目录名
let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project']

" 所生成的数据文件的名称
let g:gutentags_ctags_tagfile = '.tags'

" 同时开启 ctags 和 gtags 支持：
let g:gutentags_modules = []
if executable('ctags')
	let g:gutentags_modules += ['ctags']
endif
if executable('gtags-cscope') && executable('gtags')
	let g:gutentags_modules += ['gtags_cscope']
endif

" 将自动生成的 ctags/gtags 文件全部放入 ~/.cache/tags 目录中，避免污染工程目录
let s:vim_tags = expand('~/.cache/tags')
let g:gutentags_cache_dir = s:vim_tags
" 检测 ~/.cache/tags 不存在就新建
if !isdirectory(s:vim_tags)
   silent! call mkdir(s:vim_tags, 'p')
endif

" 配置 ctags 的参数，老的 Exuberant-ctags 不能有 --extra=+q，注意
let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']

" 如果使用 universal ctags 需要增加下面一行，老的 Exuberant-ctags 不能加下一行
let g:gutentags_ctags_extra_args += ['--output-format=e-ctags']

" 禁用 gutentags 自动加载 gtags 数据库的行为
let g:gutentags_auto_add_gtags_cscope = 0


Plug 'skywind3000/gutentags_plus'
" enable gtags module
let g:gutentags_modules = ['ctags', 'gtags_cscope']
" config project root markers.
let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project']
" generate datebases in my cache directory, prevent gtags files polluting my project
let g:gutentags_cache_dir = expand('~/.cache/tags')
" change focus to quickfix window after search (optional).
let g:gutentags_plus_switch = 1

":GscopeFind {querytype} {name}
"{querytype} corresponds to the actual cscope line interface numbers as well as default nvi commands:
"0 or s: Find this symbol
"1 or g: Find this definition
"2 or d: Find functions called by this function
"3 or c: Find functions calling this function
"4 or t: Find this text string
"6 or e: Find this egrep pattern
"7 or f: Find this file
"8 or i: Find files #including this file
"9 or a: Find places where this symbol is assigned a value
let g:gutentags_plus_nomap = 1

"default:<leader>cs	Find symbol (reference) under cursor
noremap <silent> gr :GscopeFind s <C-R><C-W><cr>
"default:<leader>cg	Find symbol definition under cursor
noremap <silent> gd :GscopeFind g <C-R><C-W><cr>
"default:<leader>cd	Functions called by this function
noremap <silent> gc :GscopeFind c <C-R><C-W><cr>
"default:<leader>cc	Functions calling this function
noremap <silent> gt :GscopeFind t <C-R><C-W><cr>
"default:<leader>ct	Find text string under cursor
noremap <silent> ge :GscopeFind e <C-R><C-W><cr>
"default:<leader>ce	Find egrep pattern under cursor
noremap <silent> gp :GscopeFind f <C-R>=expand("<cfile>")<cr><cr>
"default:<leader>cf	Find file name under cursor
noremap <silent> gi :GscopeFind i <C-R>=expand("<cfile>")<cr><cr>
"default:<leader>ci	Find files #including the file name under cursor
noremap <silent> gf :GscopeFind d <C-R><C-W><cr>
"default:<leader>ca	Find places where current symbol is assigned
noremap <silent> ga :GscopeFind a <C-R><C-W><cr>
"default:<leader>cz	Find current word in ctags database
noremap <silent> gz :GscopeFind z <C-R><C-W><cr>

"----------------------------------------------------------------------
" markdown
" 实时预览markdown
"----------------------------------------------------------------------
Plug 'iamcco/mathjax-support-for-mkdp'
Plug 'iamcco/markdown-preview.vim'

"----------------------------------------------------------------------
" ale
" 实时代码错误提示
"----------------------------------------------------------------------
Plug 'dense-analysis/ale'
let g:ale_linters_explicit = 1
let g:ale_completion_delay = 500
let g:ale_echo_delay = 20
let g:ale_lint_delay = 500
let g:ale_echo_msg_format = '[%linter%] %code: %%s'
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
let g:airline#extensions#ale#enabled = 1
let g:ale_c_gcc_options = '-Wall -O0 -std=c99'
let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++11'
let g:ale_c_cppcheck_options = ''
let g:ale_cpp_cppcheck_options = ''

"----------------------------------------------------------------------
" textobj
" 文本对象全家桶
"i, 和 a, ：参数对象，可以用 di, 或 ci, 一次性删除/改写当前参数
"ii 和 ai ：缩进对象，同一个缩进层次的代码，可以用 vii 选中，dii / cii 删除或改写
"if 和 af ：函数对象，可以用 vif / dif / cif 来选中/删除/改写函数的内容
"----------------------------------------------------------------------
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-indent'
Plug 'kana/vim-textobj-syntax'
Plug 'kana/vim-textobj-function', { 'for':['c', 'cpp', 'vim', 'java'] }
Plug 'sgur/vim-textobj-parameter'

"----------------------------------------------------------------------
" 异步执行
"----------------------------------------------------------------------
Plug 'skywind3000/asyncrun.vim'
" 自动打开 quickfix window ，高度为 6
let g:asyncrun_open = 10
nnoremap qkf :call asyncrun#quickfix_toggle(6)<cr>

if has('nvim') || has('patch-8.0.902')
    Plug 'mhinz/vim-signify'
else
  Plug 'mhinz/vim-signify', { 'branch': 'legacy' }
endif

Plug 'scrooloose/nerdtree'
Plug 'xvhfeng/nerdtree'          " File tree manager
"开启/关闭nerdtree快捷键
nnoremap <silent> <leader>nn :NERDTreeToggle<CR>
"设置树的显示图标
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
let g:NERDTreeChDirMode = 3  "Change current folder as root
"当NERDTree为剩下的唯一窗口时自动关闭
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") &&b:NERDTreeType == "primary") | q | endif
let NERDTreeQuitOnOpen=1   " Close NERDtree when files was opened
let NERDTreeMinimalUI=1    " Start NERDTree in minimal UI mode (No help lines)
let NERDTreeDirArrows=1    " Display arrows instead of ascii art in NERDTree
let g:NERDTreeHidden=1     " Don't show hidden files
let NERDTreeWinSize=30     " Initial NERDTree width
let NERDTreeAutoDeleteBuffer = 1  " Auto delete buffer deleted with NerdTree
let NERDTreeIgnore = ['\.pyc$', '\.swp', '\.swo', '__pycache__','\.o']   " Hide temp files in NERDTree
let g:NERDTreeShowLineNumbers=1  " Show Line Number
Plug 'jistr/vim-nerdtree-tabs'      " enhance nerdtree's tabs
Plug 'ryanoasis/vim-devicons'       " add beautiful icons besides files
Plug 'Xuyuanp/nerdtree-git-plugin'  " display git status within Nerdtree
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " enhance devicons

Plug 'octol/vim-cpp-enhanced-highlight'
let g:cpp_class_scope_highlight = 1

if has('nvim')
    Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
    Plug 'mg979/vim-visual-multi', {'branch': 'master'}
    "Exit                  <Esc>       quit VM
    "Find Under            <C-n>       select the word under cursor
    "Find Subword Under    <C-n>       from visual mode, without word boundaries
    "Find Next               n         find next occurrence
    "Find Prev               N         find previous occurrence
    "Goto Next               ]         go to next selected region
    "Goto Prev               [         go to previous selected region
    "Seek Next             <C-f>       fast go to next (from next page)
    "Seek Prev             <C-b>       fast go to previous (from previous page)
    "Skip Region             q         skip and find to next
    "Remove Region           Q         remove region under cursor
    "Slash Search            g/        extend/move cursors with /
    "Replace                 R         replace in regions, or start replace mode
    "Toggle Multiline        M         see |vm-multiline-mode|
else
    Plug 'Shougo/deoplete.nvim'
    Plug 'roxma/nvim-yarp'
    Plug 'roxma/vim-hug-neovim-rpc'

    Plug 'terryma/vim-multiple-cursors'
    let g:multi_cursor_use_default_mapping=1
    let g:multi_cursor_next_key='<C-n>'
    let g:multi_cursor_prev_key='<C-p>'
    let g:multi_cursor_skip_key='<C-k>'
    let g:multi_cursor_quit_key='<Esc>'
endif
let g:deoplete#enable_at_startup = 1

if has('nvim')
    Plug 'neovim/nvim-lspconfig'
    "Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
    "Plug 'kabouzeid/nvim-lspinstall'
    Plug 'nvim-lua/completion-nvim'
endif

call plug#end()

if has('nvim')
    let g:gruvbox_contrast_dark = 'hard'
    if exists('+termguicolors')
        let &t_8f= "\<ESC>[38;2;%lu;%lu;%lum"
        let &t_8b= "\<ESC>[48;2;%lu;%lu;%lum"
    endif
    let g:gruvbox_invert_selection='0'
    "colorscheme gruvbox
    set background=dark
    set completeopt=menuone,noinsert,noselect
    let g:completion_matching_strategy_list=['exact','substring','fuzzy']

    " lua require'lspinstall'.setup()
    " lua require'lspconfig'.tsserver.setup{}
    " lua require'lspconfig'.clangd.setup{}

    "local servers = require'lspinstall'.installed_servers()
    "for _, server in pairs(servers) do
    "    require'lspconfig'[server].setup{}
    "end

    "EOF
endif

filetype plugin indent on
filetype on
